import request from '@/utils/request'

enum Api {
  GetIndex = '/agent/newOrderReview/index',
  GetOrder = '/agent/collectionOrderManagement/index',
  GetCollection = '/agent/collectionMessage/index',
  ReviewOrder = '/agent/collectionOrderManagement/ReviewOrder',
  CloseOrder = '/agent/collectionOrderManagement/CancelOrder',
  GetCollectionIndex = '/agent/collection/index',
  GetCollectionOrderInfo = '/agent/collection/OrderSuccess',
  GetCollectionCode = '/agent/collection/code',
  EditCollection = '/agent/collection/editCode',
  DeleteCollection = '/agent/collection/delCode',
  GetCollectionCount = '/agent/orderStatistics/index',
  GetBanks = '/agent/collection/banks',
  AddCollection = '/agent/collection/addCode',
  GetArea = '/agent/collectionMessage/area',
  ConfirmReceipt = '/agent/newOrderReview/confirmReceipt',
  ReviewReceipt = '/agent/newOrderReview/ReviewOrder',
  OrderInfo = '/agent/newOrderReview/orderReviewEdit',
  EditCollectionArray = '/agent/collection/editListStatus',
  GetCollectionTime = '/agent/newOrderReminder/collectionTime',
  GetRateCode = '/agent/view/getRateCode'
}

export function GetRateCodeApi(id: string) {
  return request.post(Api.GetRateCode, { id }, { showError: false })
}

export function EditCollectionArrayApi(params: any) {
  return request.post(Api.EditCollectionArray, params)
}

export function getIndexApi(params: any) {
  return request.post(Api.GetIndex + `?page=${params.page}&limit=${params.pageSize}`, params)
}

export function getOrderApi(params: any) {
  return request.post(Api.GetOrder + `?page=${params.page}&limit=${params.pageSize}`, params)
}

export function getCollectionApi(params?: any) {
  return request.post(Api.GetCollection + `?page=${params.page}&limit=${params.pageSize}`, params)
}

export function ReviewOrderApi(params: { orderNo: string }) {
  return request.post(Api.ReviewOrder, params)
}

export function CloseOrderApi(params: { orderNo: string }) {
  return request.post(Api.CloseOrder, params)
}

export function getCollectionIndexApi(params: any) {
  return request.post(
    Api.GetCollectionIndex + `?page=${params.page}&limit=${params.pageSize}`,
    params
  )
}

export function GetCollectionOrderInfo(params: { id: string }) {
  return request.post(Api.GetCollectionOrderInfo, params)
}
export function GetCollectionCodeApi(params: any) {
  return request.post(Api.GetCollectionCode, params)
}
export function EditCollectionApi(params: any) {
  return request.post(Api.EditCollection, params)
}

export function DeleteCollectionApi(params: { ids: string[] }) {
  return request.delete(Api.DeleteCollection, {
    data: params
  })
}

export function GetCollectionCountApi(params: any) {
  return request.post(
    Api.GetCollectionCount + `?page=${params.page}&limit=${params.pageSize}`,
    params
  )
}

export function GetBanksApi(params: any) {
  return request.post(Api.GetBanks, params)
}

export function AddCollectionApi(params: any) {
  return request.post(Api.AddCollection, params)
}

export function GetAreaApi(params: { id: string }) {
  return request.post(Api.GetArea, params)
}

export function ConfirmReceiptApi(params: { orderNo: string }) {
  return request.post(Api.ConfirmReceipt, params)
}

export function ReviewReceiptApi(params: { orderNo: string }) {
  return request.post(Api.ReviewReceipt, params)
}

export function OrderInfoApi(params: { orderNo: string }) {
  return request.post(Api.OrderInfo, params)
}

export function GetCollectionTimeApi() {
  return request.post(Api.GetCollectionTime)
}
